package com.rimi.service.impl;

import com.rimi.bean.BroadcastImage;
import com.rimi.cache.AdminCache;
import com.rimi.dao.BroadcastImageDao;
import com.rimi.service.BroadcastImageService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * InnoDB free: 11264 kB 服务实现类
 * </p>
 *
 * @author sky
 * @since 2018-06-13
 */
@Service
public class BroadcastImageServiceImpl extends ServiceImpl<BroadcastImageDao, BroadcastImage> implements BroadcastImageService {
    @Autowired
    private AdminCache adminCache;
    @Autowired
    private BroadcastImageService broadcastImageService;

    @Override
    public List<BroadcastImage> getBroadcastImage() {
        List broadcast = adminCache.getCacheList("Broadcast", BroadcastImage.class);
        if (broadcast!=null&&!broadcast.isEmpty()){
            return broadcast;
        }
        List<BroadcastImage> broadcastImages = broadcastImageService.selectList(null);
        adminCache.addCacheList("Broadcast", broadcastImages);
        return broadcastImages;
    }
}
